import React, {useEffect, useState} from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  TextInput,
  Image,
  KeyboardAvoidingView,
  Platform,
} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import Video from 'react-native-video';
import AreaView from '../../components/Layout/AreaView';
import styles from './style';
import BaseUrl from '../../config/BaseUrl';
import {courseDetail} from '../../service/my';

const VideoDetail = () => {
  const navigation = useNavigation();
  const [list, setList] = useState([]);
  useEffect(() => {

    courseDetail().then((res) => {
      console.log(res, 'courseList');
      setList(res.rows);
    });

  }, [navigation]);

  return (
    <AreaView>
      <Video
        style={styles.video}
        muted={false} //控制音频是否静音
        repeat={false} //确定在到达结尾时是否重复播放视频。
        playInBackground={false}
        allowsExternalPlayback={false}
        ignoreSilentSwitch={'ignore'}
        resizeMode="contain" //缩放模式
        source={{
          uri:
            'https://vd4.bdstatic.com/mda-mdizpwybze2t3f14/fhd/cae_h264_nowatermark/1618876247/mda-mdizpwybze2t3f14.mp4?v_from_s=nj_haokan_4469&auth_key=1618920748-0-0-b5f559495fc8a7a97649ed0d0e46c8d7&bcevod_channel=searchbox_feed&pd=1&pt=3&abtest=',
        }}
      />
      <View style={styles.content_container}>
        <View style={styles.content_big}>
          <Text style={styles.big_title}>标题文字文字文字文字</Text>
          <Text style={styles.big_desc}>
            课程标题课程标题标题课程标题课程标题标题课程标题课程标题标题课程标题课标题课程标题标题课程标题课标题课程标题标题课程标题课标题课程标题标题课程标题课标题课程标题标题课程标题课
          </Text>
        </View>
        <View style={styles.content_small}>
          <Text style={styles.small_title}>标题文字文字文字文字</Text>
          <Text style={styles.small_desc}>
            课程标题课程标题标题课程标题课程标题标题课程标题课程标题标题课程标题课标题课程标题标题课程标题课标题课程标题标题课程标题课标题课程标题标题课程标题课标题课程标题标题课程标题课
          </Text>
        </View>
        <View style={styles.btn_container}>
          <TouchableOpacity  activeOpacity={1} activeOpacity={1} style={styles.btn}>
            <Text style={styles.btn_text}>上一张</Text>
          </TouchableOpacity>
          <TouchableOpacity  activeOpacity={1} activeOpacity={1} style={styles.btn}>
            <Text style={styles.btn_text}>下一张</Text>
          </TouchableOpacity>
        </View>
      </View>
      <KeyboardAvoidingView
        behavior={Platform.OS === 'ios' ? 'padding' : ''}
        style={styles.bottom}>
        <TouchableOpacity  activeOpacity={1} activeOpacity={1} style={styles.img_contaienr}>
          <Image
            style={styles.like_icon}
            source={require('../../assets/images/like.png')}
          />
        </TouchableOpacity>
        <View style={styles.input_box}>
          <TextInput style={styles.input} placeholder="留言问题" />
        </View>
      </KeyboardAvoidingView>
    </AreaView>
  );
};

export default VideoDetail;
